home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / util / batch / pause380.lha / Pause / src / pause.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1995-05-17  |  1.4 KB  |  62 lines

  1. program pause;
  2.  
  3. {
  4. Pause source file, use HSPascal v1.20 and WB3.1 units to compile.
  5.  
  6. Sorry for not commenting the source properly, see what you can make
  7. of it anyway.
  8.  
  9. Author Nicolai Jensen 17-May-1995
  10. }
  11.  
  12. Uses exec, Paus, crt, AmigaDOS, init;
  13. const 
  14.     Version = '$VER: Pause 38.0 (17.05.95)'#0;
  15. var
  16.     Ver            : string[29];
  17.     DummyBool    : boolean;
  18.     Break        : longint;
  19.     OldExitProc : pointer;    { Exit Handler }
  20.  
  21. procedure Slut_Prog;
  22. { Procedure to  Finish nicely no matter how the program exits }
  23. begin
  24.     ExitProc := OldExitProc;    
  25.     ClosePauseCatalog;
  26.     CloseLibs;
  27. end;
  28.  
  29.  
  30. procedure HandleBreak;
  31. var
  32.         ProgNam : Strptr;
  33.         pDummePointer    : strptr;               
  34. begin
  35.     DummyBool:=GetProgramName(ProgNam,128);
  36.     writeln;
  37.     pDummePointer := ProgNam;
  38.     DummyBool := Printfault(ERROR_BREAK, pDummePointer);
  39.     halt(ERROR_BREAK);
  40. end;
  41.  
  42.  
  43. Begin
  44.     OldExitProc := exitproc;    { These 2 lines makes Slut_Prog to an exit-routine, }
  45.     ExitProc := @Slut_Prog;        { which is executed when/if the program is interrupted }
  46.     {
  47.         In HSPascal version strings has to be active parts of the code... (AFAIK)
  48.         That is why the following line is required in this program
  49.     }
  50.     Ver:=Version;
  51.  
  52.     DummyBool:=OpenLibs;
  53.     OpenPauseCatalog(nil,nil);
  54.     write(GetString(Long(PauseText))); { Pause text is 'Pause... hit <ENTER> to continue' }
  55.     repeat
  56.         Break := checksignal(SIGBREAKF_CTRL_C);
  57.         if Break <> 0 then
  58.             HandleBreak;
  59.     until readkey=#13;
  60.     writeln;
  61. end.
  62.